package com.rasenhund.android.gsimulator.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

import com.rasenhund.android.gsimulator.R;
import com.rasenhund.android.gsimulator.common.Const.CATEGORY;
import com.rasenhund.android.gsimulator.common.Const.KEY;

/**
 * カテゴリ選択画面
 */
public class SelectCategoryActivity extends BaseActivity {
    @SuppressWarnings("unused")
    private static final String TAG = SelectCategoryActivity.class.getSimpleName();
    private final SelectCategoryActivity self = this;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.select_category);

        Button btnGrapp = (Button) findViewById(R.id.btnGrapp);
        btnGrapp.setOnClickListener(btnGrapp_OnClickListener);

        Button btnProx = (Button) findViewById(R.id.btnProx);
        btnProx.setOnClickListener(btnProx_OnClickListener);

        Button btnShoot = (Button) findViewById(R.id.btnShoot);
        btnShoot.setOnClickListener(btnShoot_OnClickListener);

        Button btnCannon = (Button) findViewById(R.id.btnCannon);
        btnCannon.setOnClickListener(btnCannon_OnClickListener);

        Button btnSnip = (Button) findViewById(R.id.btnSnip);
        btnSnip.setOnClickListener(btnSnipe_OnClickListener);
        
    }
    
    /********************
     * EventListener
     ********************/

    /**
     * 格ボタン押下時の EventListener
     */
    final OnClickListener btnGrapp_OnClickListener = new OnClickListener() {        
        @Override
        public void onClick(View v) {

            moveNext(CATEGORY.GRAPP);

        }
    };
    
    /**
     * 近ボタン押下時の EventListener
     */
    final OnClickListener btnProx_OnClickListener = new OnClickListener() {        
        @Override
        public void onClick(View v) {

            moveNext(CATEGORY.SHORT);

        }
    };
    
    /**
     * 射ボタン押下時の EventListener
     */
    final OnClickListener btnShoot_OnClickListener = new OnClickListener() {        
        @Override
        public void onClick(View v) {

            moveNext(CATEGORY.SHOOT);

        }
    };
    
    /**
     * 遠ボタン押下時の EventListener
     */
    final OnClickListener btnCannon_OnClickListener = new OnClickListener() {        
        @Override
        public void onClick(View v) {

            moveNext(CATEGORY.TANK);

        }
    };
    
    /**
     * 狙ボタン押下時の EventListener
     */
    final OnClickListener btnSnipe_OnClickListener = new OnClickListener() {        
        @Override
        public void onClick(View v) {

            moveNext(CATEGORY.SNIPE);

        }
    };
    
    /********************
     * Method
     ********************/
    /**
     * MS選択画面へ遷移
     */
    private void moveNext(int categoryCd) {

        Intent intent = new Intent(self, SelectMsActivity.class);
        intent.putExtra(KEY.KEY_CATEGORY_CD, categoryCd);
        startActivity(intent);

    }

}
